package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Pixmap;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.TextureData;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;
import com.corona.game.util.LoadingZone;
import com.corona.game.util.SpriteProxy;
import com.corona.game.util.TextureCache;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;

/* loaded from: pokewilds.jar:com/pkmngen/game/Player.class */
public class Player {
    public String dirFacing;
    public Map<String, Sprite> standingSprites;
    public Map<String, Sprite> movingSprites;
    public Map<String, Sprite> altMovingSprites;
    public Pokemon hmPokemon;
    public int spriteOffsetY;
    public Vector2 position;
    public Sprite currSprite;
    public SpriteProxy battleSprite;
    public Sprite fishingSprites;
    public Sprite sittingSprites;
    public Sprite sleepingSprite;
    public Sprite sleepingBagSprite;
    public String name;
    public Color color;
    public ArrayList<Pokemon> pokemon;
    public Pokemon currPokemon;
    private Map<String, Integer> itemsDict;
    public int adrenaline;
    public String currState;
    public String currFieldMove;
    public Tile currDigTile;
    public boolean isCrafting;
    public boolean isSitting;
    public boolean isSleeping;
    public Vector2 sleepingDir;
    public Flying flyingAction;
    public boolean drawSleepingBag;
    public boolean acceptInput;
    boolean isNearCampfire;
    public Tile currBuildTile;
    public int buildTileIndex;
    public ArrayList<Tile> terrainTiles;
    public ArrayList<Tile> buildTiles;
    public ArrayList<Tile> outdoorBuildTiles;
    public ArrayList<Tile> indoorBuildTiles;
    public ArrayList<Tile> desertBuildTiles;
    public ArrayList<Tile> smeargleBuildTiles;
    public ArrayList<Tile> smeargleInteriorTiles;
    public ArrayList<Tile> bridgeBuildTiles;
    public ArrayList<Tile> tundraBuildTiles;
    public ArrayList<Tile> woodedLakeBuildTiles;
    public HashMap<String, HashMap<String, Integer>> buildTileRequirements;
    public boolean canMove;
    int numFlees;
    public Sprite zSprite;
    int zsTimer;
    public int repelCounter;
    public Vector2 spawnLoc;
    int spawnIndex;
    public PlayerStanding standingAction;
    public boolean displayedMaxPartyText;
    public boolean enteredDesertBiome;
    public int eggStepTimer;
    public int friendshipStepTimer;
    public boolean nearAggroPokemon;
    public boolean nearCacturne;
    public String character;
    public Color skinColor;
    public String currPlanting;
    public String currRod;
    public boolean isFishing;
    public ArrayList<String> alreadyDoneHarvestables;
    public boolean dontDrawMapDuringBattle;
    public DrawPlayerLower drawPlayerLower;
    public DrawPlayerUpper drawPlayerUpper;
    public Type type;
    public Network network;
    public ArrayList<Craft> fossilCrafts;
    public ArrayList<Craft> regiCrafts;
    public static boolean drawSproutSprite = true;
    public static Sprite sproutSprite = new Sprite(TextureCache.get(Gdx.files.internal("sprout_sheet2.png")), 64, 0, 16, 16);
    public static Sprite sproutSprite2 = new Sprite(TextureCache.get(Gdx.files.internal("tiles/place_something1.png")), 0, 0, 16, 16);
    public static Sprite desertGrassSprite = new Sprite(TextureCache.get(Gdx.files.internal("grass_over_sheet3.png")), 0, 0, 16, 16);
    public static Sprite snowDriftSprite = new Sprite(TextureCache.get(Gdx.files.internal("grass_over_sheet4.png")), 0, 0, 16, 16);
    public static Sprite sootDriftSprite = new Sprite(TextureCache.get(Gdx.files.internal("grass_over_sheet5.png")), 0, 0, 16, 16);
    public static Sprite currGrassOverSprite = desertGrassSprite;
    public static HashMap<String, String> oppDirs = new HashMap<>();
    public static ArrayList<Craft> crafts = new ArrayList<>();
    public static ArrayList<Craft> kilnCrafts = new ArrayList<>();

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Type.class */
    public enum Type {
        LOCAL,
        REMOTE
    }

    static {
        oppDirs.put("up", "down");
        oppDirs.put("down", "up");
        oppDirs.put("right", "left");
        oppDirs.put("left", "right");
        Craft craft = new Craft("heavy ball", 1);
        craft.requirements.add(new Craft("black apricorn", 1));
        crafts.add(craft);
        Craft craft2 = new Craft("lure ball", 1);
        craft2.requirements.add(new Craft("blue apricorn", 1));
        crafts.add(craft2);
        Craft craft3 = new Craft("friend ball", 1);
        craft3.requirements.add(new Craft("green apricorn", 1));
        crafts.add(craft3);
        Craft craft4 = new Craft("love ball", 1);
        craft4.requirements.add(new Craft("pink apricorn", 1));
        crafts.add(craft4);
        Craft craft5 = new Craft("level ball", 1);
        craft5.requirements.add(new Craft("red apricorn", 1));
        crafts.add(craft5);
        Craft craft6 = new Craft("fast ball", 1);
        craft6.requirements.add(new Craft("white apricorn", 1));
        crafts.add(craft6);
        Craft craft7 = new Craft("moon ball", 1);
        craft7.requirements.add(new Craft("yellow apricorn", 1));
        crafts.add(craft7);
        Craft craft8 = new Craft("soft bedding", 1);
        craft8.requirements.add(new Craft("soft feather", 3));
        craft8.requirements.add(new Craft("silky thread", 3));
        crafts.add(craft8);
        Craft craft9 = new Craft("repel", 1);
        craft9.requirements.add(new Craft("charcoal", 1));
        craft9.requirements.add(new Craft("manure", 1));
        crafts.add(craft9);
        Craft craft10 = new Craft("max repel", 1);
        craft10.requirements.add(new Craft("poison barb", 1));
        craft10.requirements.add(new Craft("repel", 1));
        crafts.add(craft10);
        Craft craft11 = new Craft("rare candy", 1);
        craft11.requirements.add(new Craft("berry juice", 3));
        craft11.requirements.add(new Craft("ancientpowder", 1));
        crafts.add(craft11);
        Craft craft12 = new Craft("clear glass", 1);
        craft12.requirements.add(new Craft("soft sand", 3));
        crafts.add(craft12);
        Craft craft13 = new Craft("silph scope", 1);
        craft13.requirements.add(new Craft("clear glass", 2));
        craft13.requirements.add(new Craft("metal coat", 2));
        crafts.add(craft13);
        Craft craft14 = new Craft("binding band", 1);
        craft14.requirements.add(new Craft("grass", 3));
        crafts.add(craft14);
        Craft craft15 = new Craft("thin paper", 1);
        craft15.requirements.add(new Craft("log", 1));
        crafts.add(craft15);
        Craft craft16 = new Craft("ragecandybar", 1);
        craft16.requirements.add(new Craft("honey", 2));
        craft16.requirements.add(new Craft("charcoal", 1));
        crafts.add(craft16);
        Craft craft17 = new Craft("old rod", 1);
        craft17.requirements.add(new Craft("log", 1));
        craft17.requirements.add(new Craft("silky thread", 1));
        crafts.add(craft17);
        Craft craft18 = new Craft("good rod", 1);
        craft18.requirements.add(new Craft("old rod", 1));
        craft18.requirements.add(new Craft("metal coat", 2));
        crafts.add(craft18);
        Craft craft19 = new Craft("super rod", 1);
        craft19.requirements.add(new Craft("good rod", 1));
        craft19.requirements.add(new Craft("magnet", 3));
        crafts.add(craft19);
        Craft craft20 = new Craft("spell tag", 1);
        craft20.requirements.add(new Craft("life force", 1));
        craft20.requirements.add(new Craft("thin paper", 1));
        crafts.add(craft20);
        Craft craft21 = new Craft("stardust", 1);
        craft21.requirements.add(new Craft("star piece", 1));
        crafts.add(craft21);
        Craft craft22 = new Craft("poké ball", 1);
        craft22.requirements.add(new Craft("magnet", 1));
        craft22.requirements.add(new Craft("hard shell", 1));
        crafts.add(craft22);
        Craft craft23 = new Craft("great ball", 1);
        craft23.requirements.add(new Craft("poké ball", 1));
        craft23.requirements.add(new Craft("metal coat", 1));
        kilnCrafts.add(craft23);
        Craft craft24 = new Craft("ultra ball", 1);
        craft24.requirements.add(new Craft("great ball", 1));
        craft24.requirements.add(new Craft("life force", 1));
        kilnCrafts.add(craft24);
        Craft craft25 = new Craft("dusk ball", 1);
        craft25.requirements.add(new Craft("moon ball", 1));
        craft25.requirements.add(new Craft("dark energy", 1));
        kilnCrafts.add(craft25);
        Craft craft26 = new Craft("net ball", 1);
        craft26.requirements.add(new Craft("lure ball", 1));
        craft26.requirements.add(new Craft("silky thread", 1));
        kilnCrafts.add(craft26);
        Craft craft27 = new Craft("dive ball", 1);
        craft27.requirements.add(new Craft("lure ball", 1));
        craft27.requirements.add(new Craft("hard shell", 1));
        kilnCrafts.add(craft27);
        Craft craft28 = new Craft("quick ball", 1);
        craft28.requirements.add(new Craft("fast ball", 1));
        craft28.requirements.add(new Craft("magnet", 1));
        kilnCrafts.add(craft28);
        Craft craft29 = new Craft("heal ball", 1);
        craft29.requirements.add(new Craft("friend ball", 1));
        craft29.requirements.add(new Craft("stardust", 1));
        kilnCrafts.add(craft29);
        Craft craft30 = new Craft("nest ball", 1);
        craft30.requirements.add(new Craft("friend ball", 1));
        craft30.requirements.add(new Craft("binding band", 1));
        kilnCrafts.add(craft30);
        Craft craft31 = new Craft("dream ball", 1);
        craft31.requirements.add(new Craft("love ball", 1));
        craft31.requirements.add(new Craft("psi energy", 1));
        kilnCrafts.add(craft31);
        Craft craft32 = new Craft("timer ball", 1);
        craft32.requirements.add(new Craft("heavy ball", 1));
        craft32.requirements.add(new Craft("hard stone", 1));
        kilnCrafts.add(craft32);
    }

    public Map<String, Integer> getItemsDict() {
        return this.itemsDict;
    }

    public boolean hasItem(String name) {
        return this.itemsDict.containsKey(name);
    }

    public Integer getItemAmount(String name) {
        return this.itemsDict.get(name);
    }

    public void setItemAmount(String name, int amount) {
        this.itemsDict.put(name, Integer.valueOf(amount));
    }

    public void removeItem(String name) {
        this.itemsDict.remove(name);
    }

    public void setPlayerItems(Map<String, Integer> itemsDict) {
        this.itemsDict = itemsDict;
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Craft.class */
    public static class Craft {
        String name;
        int amount;
        ArrayList<Craft> requirements = new ArrayList<>();

        public Craft(String name, int amount) {
            this.name = name;
            this.amount = amount;
        }
    }

    public Player() {
        this.dirFacing = "down";
        this.standingSprites = new HashMap();
        this.movingSprites = new HashMap();
        this.altMovingSprites = new HashMap();
        this.hmPokemon = null;
        this.spriteOffsetY = 0;
        this.currSprite = new Sprite();
        this.color = new Color(0.9137255f, 0.5294118f, 0.1764706f, 1.0f);
        this.currFieldMove = "";
        this.currDigTile = new Tile("hole1", new Vector2(0.0f, 0.0f));
        this.isCrafting = false;
        this.isSitting = false;
        this.isSleeping = false;
        this.sleepingDir = null;
        this.flyingAction = null;
        this.drawSleepingBag = false;
        this.acceptInput = true;
        this.isNearCampfire = false;
        this.buildTileIndex = 0;
        this.terrainTiles = new ArrayList<>();
        this.buildTiles = new ArrayList<>();
        this.outdoorBuildTiles = new ArrayList<>();
        this.indoorBuildTiles = new ArrayList<>();
        this.desertBuildTiles = new ArrayList<>();
        this.smeargleBuildTiles = new ArrayList<>();
        this.smeargleInteriorTiles = new ArrayList<>();
        this.bridgeBuildTiles = new ArrayList<>();
        this.tundraBuildTiles = new ArrayList<>();
        this.woodedLakeBuildTiles = new ArrayList<>();
        this.buildTileRequirements = new HashMap<>();
        this.canMove = true;
        this.numFlees = 0;
        this.zsTimer = 0;
        this.repelCounter = 0;
        this.spawnLoc = new Vector2(0.0f, 0.0f);
        this.spawnIndex = -1;
        this.displayedMaxPartyText = false;
        this.enteredDesertBiome = false;
        this.eggStepTimer = 0;
        this.friendshipStepTimer = 0;
        this.nearAggroPokemon = false;
        this.nearCacturne = false;
        this.character = "gold";
        this.skinColor = new Color(1.0f, 0.80784315f, 0.28235295f, 1.0f);
        this.currPlanting = null;
        this.currRod = "";
        this.isFishing = false;
        this.alreadyDoneHarvestables = new ArrayList<>();
        this.dontDrawMapDuringBattle = false;
        this.drawPlayerLower = new DrawPlayerLower();
        this.drawPlayerUpper = new DrawPlayerUpper();
        this.fossilCrafts = new ArrayList<>();
        Craft craft = new Craft("AERODACTYL", 1);
        craft.requirements.add(new Craft("old amber", 1));
        this.fossilCrafts.add(craft);
        Craft craft2 = new Craft("OMANYTE", 1);
        craft2.requirements.add(new Craft("helix fossil", 1));
        this.fossilCrafts.add(craft2);
        Craft craft3 = new Craft("KABUTO", 1);
        craft3.requirements.add(new Craft("dome fossil", 1));
        this.fossilCrafts.add(craft3);
        Craft craft4 = new Craft("ANORITH", 1);
        craft4.requirements.add(new Craft("claw fossil", 1));
        this.fossilCrafts.add(craft4);
        Craft craft5 = new Craft("LILEEP", 1);
        craft5.requirements.add(new Craft("root fossil", 1));
        this.fossilCrafts.add(craft5);
        Craft craft6 = new Craft("SHIELDON", 1);
        craft6.requirements.add(new Craft("shield fossil", 1));
        this.fossilCrafts.add(craft6);
        Craft craft7 = new Craft("CRANIDOS", 1);
        craft7.requirements.add(new Craft("skull fossil", 1));
        this.fossilCrafts.add(craft7);
        this.regiCrafts = new ArrayList<>();
        Craft craft8 = new Craft("REGISTEEL", 1);
        craft8.requirements.add(new Craft("metal coat", 47));
        craft8.requirements.add(new Craft("spell tag", 1));
        this.regiCrafts.add(craft8);
        Craft craft9 = new Craft("REGIROCK", 1);
        craft9.requirements.add(new Craft("hard stone", 47));
        craft9.requirements.add(new Craft("spell tag", 1));
        this.regiCrafts.add(craft9);
        Craft craft10 = new Craft("REGICE", 1);
        craft10.requirements.add(new Craft("nevermeltice", 47));
        craft10.requirements.add(new Craft("spell tag", 1));
        this.regiCrafts.add(craft10);
        Craft craft11 = new Craft("REGIDRAGO", 1);
        craft11.requirements.add(new Craft("dragon scale", 43));
        craft11.requirements.add(new Craft("dragon fang", 4));
        craft11.requirements.add(new Craft("spell tag", 1));
        this.regiCrafts.add(craft11);
        Craft craft12 = new Craft("REGIELEKI", 1);
        craft12.requirements.add(new Craft("magnet", 43));
        craft12.requirements.add(new Craft("binding band", 4));
        craft12.requirements.add(new Craft("spell tag", 1));
        this.regiCrafts.add(craft12);
        this.zSprite = new Sprite(TextureCache.get(Gdx.files.internal("tiles/zs1.png")), 0, 0, 16, 16);
        Texture playerText = TextureCache.get(Gdx.files.internal("player/gold-walking.png"));
        this.standingSprites.put("down", new Sprite(playerText, 0, 0, 16, 16));
        this.standingSprites.put("up", new Sprite(playerText, 16, 0, 16, 16));
        this.standingSprites.put("left", new Sprite(playerText, 32, 0, 16, 16));
        this.standingSprites.put("right", new Sprite(playerText, 48, 0, 16, 16));
        this.movingSprites.put("down", new Sprite(playerText, 64, 0, 16, 16));
        this.movingSprites.put("up", new Sprite(playerText, 80, 0, 16, 16));
        this.movingSprites.put("left", new Sprite(playerText, 96, 0, 16, 16));
        this.movingSprites.put("right", new Sprite(playerText, 112, 0, 16, 16));
        this.altMovingSprites.put("down", new Sprite(playerText, 64, 0, 16, 16));
        this.altMovingSprites.get("down").flip(true, false);
        this.altMovingSprites.put("up", new Sprite(playerText, 80, 0, 16, 16));
        this.altMovingSprites.get("up").flip(true, false);
        this.altMovingSprites.put("left", new Sprite(playerText, 96, 0, 16, 16));
        this.altMovingSprites.put("right", new Sprite(playerText, 112, 0, 16, 16));
        Texture playerText2 = TextureCache.get(Gdx.files.internal("player/gold-running.png"));
        this.standingSprites.put("down_running", new Sprite(playerText2, 0, 0, 16, 16));
        this.standingSprites.put("up_running", new Sprite(playerText2, 16, 0, 16, 16));
        this.standingSprites.put("left_running", new Sprite(playerText2, 32, 0, 16, 16));
        this.standingSprites.put("right_running", new Sprite(playerText2, 48, 0, 16, 16));
        this.movingSprites.put("down_running", new Sprite(playerText2, 64, 0, 16, 16));
        this.movingSprites.put("up_running", new Sprite(playerText2, 80, 0, 16, 16));
        this.movingSprites.put("left_running", new Sprite(playerText2, 96, 0, 16, 16));
        this.movingSprites.put("right_running", new Sprite(playerText2, 112, 0, 16, 16));
        this.altMovingSprites.put("down_running", new Sprite(playerText2, 64, 0, 16, 16));
        this.altMovingSprites.get("down_running").flip(true, false);
        this.altMovingSprites.put("up_running", new Sprite(playerText2, 80, 0, 16, 16));
        this.altMovingSprites.get("up_running").flip(true, false);
        this.altMovingSprites.put("left_running", new Sprite(playerText2, 96, 0, 16, 16));
        this.altMovingSprites.put("right_running", new Sprite(playerText2, 112, 0, 16, 16));
        this.battleSprite = new SpriteProxy(TextureCache.get(Gdx.files.internal("battle/player_back_color1.png")), 0, 0, 45, 46);
        this.sleepingSprite = new Sprite(TextureCache.get(Gdx.files.internal("player/gold-sleepingbag.png")), 0, 0, 24, 16);
        this.sleepingBagSprite = new Sprite(TextureCache.get(Gdx.files.internal("tiles/sleeping_bag1.png")), 0, 0, 24, 16);
        this.fishingSprites = new Sprite(TextureCache.get(Gdx.files.internal("player/gold-fishing.png")), 0, 0, 56, 24);
        this.sittingSprites = new Sprite(TextureCache.get(Gdx.files.internal("player/gold-sitting.png")), 0, 0, 48, 16);
        this.position = new Vector2(0.0f, 0.0f);
        this.currSprite = new Sprite(this.standingSprites.get(this.dirFacing));
        this.name = "AAAA";
        this.pokemon = new ArrayList<>();
        this.adrenaline = 0;
        this.currState = "";
        this.outdoorBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house5_door1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house5_middle1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house5_roof_middle1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("exteriorwindows1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("chimney1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("campfire1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("fence1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("bridge1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("potted3", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("potted4", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("statue1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house_gym1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house_plant1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("house_plant2", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("gravestone3", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("sign_built1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("warp_tile1", new Vector2(0.0f, 0.0f)));
        this.outdoorBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house9_door1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house9_NEW", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house9_roof_middle1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("exteriorwindows1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("chimney1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("campfire1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("fence1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("bridge1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("potted3", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("potted4", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("statue1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house_gym1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house_plant1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("house_plant2", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("gravestone3", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("sign_built1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("warp_tile1", new Vector2(0.0f, 0.0f)));
        this.woodedLakeBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("house6_door1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("house6_NEW", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("house6_roof_middle1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("exteriorwindows1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("chimney1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("campfire1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("fence2", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("bridge1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("potted1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("potted2", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("gravestone3", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("sign_desert1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("warp_tile1", new Vector2(0.0f, 0.0f)));
        this.desertBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("house7_wall_door1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("house7_wall_S", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("house7_roof_EW", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("exteriorwindows1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("chimney1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("fence1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("bridge1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("potted3", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("potted4", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("sign_built1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("warp_tile1", new Vector2(0.0f, 0.0f)));
        this.bridgeBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("house8_door1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("house8_SEW", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("house8_roof_middle1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("exteriorwindows1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("chimney1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("campfire1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("fence2", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("potted1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("potted2", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("gravestone3", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("sign_desert1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("warp_tile1", new Vector2(0.0f, 0.0f)));
        this.tundraBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("torch1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plant1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plant2", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_gym1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_shelf1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_wardrobe1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_vanity1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_vanity2", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_stool1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_bed1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_table1_default", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet2", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet3", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet4", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet5", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet6", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet7", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_carpet8", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("chest1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("stairs_up1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("ball_kiln1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_clock1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("interiorwall1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_couch1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_couch2", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_couch3", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_couch4", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_couch5", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_trashcan1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plushpichu", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plushduskull", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plushskitty", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_plushjigglypuff", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_window1", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("house_window2", new Vector2(0.0f, 0.0f)));
        this.indoorBuildTiles.add(new Tile("sign_built1", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture1", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture2", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture3", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture4", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture5", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture6", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture7", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture8", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture9", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture10", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture11", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture12", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture13", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture14", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture15", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture16", new Vector2(0.0f, 0.0f)));
        this.smeargleBuildTiles.add(new Tile("house_picture17", new Vector2(0.0f, 0.0f)));
        this.smeargleInteriorTiles.addAll(this.smeargleBuildTiles);
        this.smeargleInteriorTiles.add(new Tile("house_picture18", new Vector2(0.0f, 0.0f)));
        this.smeargleInteriorTiles.add(new Tile("house_picture19", new Vector2(0.0f, 0.0f)));
        this.smeargleInteriorTiles.add(new Tile("house_picture20", new Vector2(0.0f, 0.0f)));
        this.buildTiles = this.outdoorBuildTiles;
        this.currBuildTile = this.buildTiles.get(this.buildTileIndex);
        this.terrainTiles.add(new Tile("sand1", new Vector2(0.0f, 0.0f), true, new Route("beach2", 22)));
        this.terrainTiles.add(new Tile("desert4", new Vector2(0.0f, 0.0f), true, new Route("desert1", 22)));
        this.terrainTiles.add(new Tile("mountain1", new Vector2(0.0f, 0.0f), true, new Route("mountain1", 22)));
        this.terrainTiles.add(new Tile("snow2", new Vector2(0.0f, 0.0f), true, new Route("snow1", 22)));
        this.terrainTiles.add(new Tile("green1", new Vector2(0.0f, 0.0f), true, new Route("forest1", 22)));
        this.terrainTiles.add(new Tile("flower4", new Vector2(0.0f, 0.0f), true, new Route("forest1", 22)));
        this.terrainTiles.add(new Tile("volcano1", new Vector2(0.0f, 0.0f), true, new Route("volcano1", 22)));
        this.terrainTiles.add(new Tile("green12", new Vector2(0.0f, 0.0f), true, new Route("graveyard1", 22)));
        this.terrainTiles.add(new Tile("green_savanna1", new Vector2(0.0f, 0.0f), true, new Route("savanna2", 22)));
        this.terrainTiles.add(new Tile("ledges3_none", new Vector2(0.0f, 0.0f)));
        this.terrainTiles.add(new Tile("green_woodedlake", new Vector2(0.0f, 0.0f), true, new Route("wooded_lake1", 22)));
        this.terrainTiles.add(new Tile("green_deepforest", new Vector2(0.0f, 0.0f), true, new Route("deep_forest", 22)));
        ArrayList<Tile> allTiles = new ArrayList<>(this.outdoorBuildTiles);
        allTiles.addAll(this.indoorBuildTiles);
        allTiles.addAll(this.desertBuildTiles);
        allTiles.addAll(this.terrainTiles);
        allTiles.addAll(this.smeargleInteriorTiles);
        allTiles.addAll(this.bridgeBuildTiles);
        allTiles.addAll(this.tundraBuildTiles);
        allTiles.addAll(this.woodedLakeBuildTiles);
        Iterator<Tile> it = allTiles.iterator();
        while (it.hasNext()) {
            Tile tile = it.next();
            if (!tile.nameUpper.equals("sleeping_bag1")) {
                HashMap<String, Integer> requirements = new HashMap<>();
                this.buildTileRequirements.put(tile.name, requirements);
                if (tile.name.contains("campfire")) {
                    requirements.put("log", 4);
                    requirements.put("grass", 2);
                } else if (tile.name.contains("bridge")) {
                    requirements.put("log", 1);
                    requirements.put("hard stone", 1);
                } else if (tile.name.equals("house_bed1")) {
                    requirements.put("log", 4);
                    requirements.put("soft bedding", 1);
                } else if (tile.name.contains("house_couch")) {
                    requirements.put("log", 1);
                    requirements.put("soft wool", 1);
                } else if (tile.name.equals("house_gym1")) {
                    requirements.put("hard stone", 2);
                } else if (tile.name.contains("house_plant")) {
                    requirements.put("log", 1);
                    requirements.put("miracle seed", 1);
                } else if (tile.name.contains("carpet")) {
                    requirements.put("grass", 1);
                } else if (tile.name.contains("picture")) {
                    requirements.put("thin paper", 1);
                } else if (tile.name.contains("house_window")) {
                    requirements.put("clear glass", 1);
                } else if (tile.name.contains("clock")) {
                    requirements.put("log", 1);
                    requirements.put("clear glass", 1);
                } else if (tile.name.contains("house6_")) {
                    requirements.put("hard stone", 1);
                } else if (tile.name.contains("house8_")) {
                    requirements.put("grass", 1);
                    requirements.put("log", 1);
                } else if (tile.name.contains("house9_")) {
                    requirements.put("grass", 1);
                    requirements.put("log", 1);
                } else if (tile.name.contains("potted")) {
                    requirements.put("hard stone", 1);
                    requirements.put("miracle seed", 1);
                } else if (tile.name.contains("vanity")) {
                    requirements.put("log", 1);
                    requirements.put("clear glass", 1);
                } else if (tile.name.contains("plush")) {
                    if (tile.name.contains("pichu")) {
                        requirements.put("magnet", 1);
                    } else if (tile.name.contains("duskull")) {
                        requirements.put("spell tag", 1);
                    } else {
                        requirements.put("grass", 1);
                    }
                    requirements.put("soft wool", 1);
                } else if (tile.name.contains("house_")) {
                    requirements.put("log", 1);
                } else if (tile.name.equals("sand1")) {
                    requirements.put("soft sand", 1);
                } else if (tile.name.equals("desert4")) {
                    requirements.put("dry sand", 1);
                } else if (tile.name.equals("mountain1")) {
                    requirements.put("light clay", 1);
                } else if (tile.name.equals("snow2")) {
                    requirements.put("nevermeltice", 1);
                } else if (tile.name.equals("green1")) {
                    requirements.put("grass", 1);
                } else if (tile.name.equals("flower4")) {
                    requirements.put("flowers", 1);
                } else if (tile.name.equals("volcano1")) {
                    requirements.put("ashen soil", 1);
                } else if (tile.name.equals("green12")) {
                    requirements.put("cursed soil", 1);
                } else if (tile.name.equals("green_savanna1")) {
                    requirements.put("dry soil", 1);
                } else if (tile.name.equals("green_deepforest")) {
                    requirements.put("mystic soil", 1);
                } else if (tile.name.equals("green_woodedlake")) {
                    requirements.put("damp soil", 1);
                } else if (tile.name.equals("ledges3_none")) {
                    requirements.put("hard stone", 1);
                } else if (tile.name.equals("statue1")) {
                    requirements.put("hard stone", 2);
                } else if (tile.name.equals("interiorwall")) {
                    requirements.put("log", 1);
                } else if (tile.name.contains("window")) {
                    requirements.put("log", 1);
                    requirements.put("clear glass", 1);
                } else if (tile.name.equals("gravestone3")) {
                    requirements.put("hard stone", 1);
                } else if (tile.name.equals("warp_tile1")) {
                    requirements.put("dusk stone", 2);
                    requirements.put("psi energy", 2);
                    requirements.put("life force", 2);
                } else if (tile.name.equals("chest1")) {
                    requirements.put("log", 2);
                } else if (tile.name.equals("ball_kiln1")) {
                    requirements.put("hard stone", 2);
                    requirements.put("charcoal", 2);
                } else if (tile.name.contains("stairs_up")) {
                    requirements.put("log", 2);
                } else if (tile.name.contains("chimney")) {
                    requirements.put("log", 1);
                } else {
                    requirements.put("grass", 1);
                    requirements.put("log", 1);
                }
            }
        }
        this.buildTileRequirements.put("sleeping_bag1", new HashMap<>());
        this.buildTileRequirements.get("sleeping_bag1").put("sleeping bag", 1);
        setPlayerItems(new LinkedHashMap());
        setItemAmount("sleeping bag", 1);
        setItemAmount("escape rope", 1);
        if (Game.staticGame.debugInputEnabled) {
            setItemAmount("secret key", 1);
            setItemAmount("master ball", 99);
            setItemAmount("grass", 99);
            setItemAmount("log", 99);
            setItemAmount("black apricorn", 99);
            setItemAmount("green apricorn", 3);
            setItemAmount("pink apricorn", 2);
            setItemAmount("manure", 99);
            setItemAmount("berry juice", 99);
            setItemAmount("moomoo milk", 99);
            setItemAmount("ancientpowder", 99);
            setItemAmount("silph scope", 1);
            setItemAmount("soft sand", 18);
            setItemAmount("metal coat", 99);
            setItemAmount("hard stone", 99);
            setItemAmount("nevermeltice", 99);
            setItemAmount("dragon scale", 99);
            setItemAmount("dragon fang", 99);
            setItemAmount("magnet", 99);
            setItemAmount("binding band", 2);
            setItemAmount("spell tag", 88);
            setItemAmount("moon ball", 99);
            setItemAmount("love ball", 99);
            setItemAmount("heavy ball", 99);
            setItemAmount("level ball", 99);
            setItemAmount("soft bedding", 99);
            setItemAmount("miracle seed", 99);
            setItemAmount("berry seed", 99);
            setItemAmount("great ball", 99);
            setItemAmount("ultra ball", 99);
            setItemAmount("dark energy", 99);
            setItemAmount("thin paper", 99);
            setItemAmount("clear glass", 99);
            setItemAmount("hard stone", 99);
            setItemAmount("old amber", 99);
            setItemAmount("helix fossil", 99);
            setItemAmount("dome fossil", 99);
            setItemAmount("root fossil", 99);
            setItemAmount("claw fossil", 99);
            setItemAmount("shield fossil", 99);
            setItemAmount("skull fossil", 99);
            setItemAmount("flowers", 99);
            setItemAmount("light clay", 99);
            setItemAmount("ragecandybar", 99);
            setItemAmount("old rod", 1);
            setItemAmount("good rod", 1);
            setItemAmount("super rod", 1);
            setItemAmount("silky thread", 99);
            setItemAmount("thunderstone", 99);
            setItemAmount("fire stone", 99);
            setItemAmount("leaf stone", 99);
            setItemAmount("moon stone", 99);
            setItemAmount("sun stone", 99);
            setItemAmount("water stone", 99);
            setItemAmount("dawn stone", 99);
            setItemAmount("dusk stone", 99);
            setItemAmount("shiny stone", 99);
            setItemAmount("ice stone", 99);
            setItemAmount("soft wool", 99);
            setItemAmount("life force", 109);
            setItemAmount("poké doll", 99);
        }
        this.network = new Network(this.position);
        this.type = Type.LOCAL;
    }

    public Player(com.corona.game.Network.PlayerDataBase playerData) {
        this();
        if (playerData instanceof com.corona.game.Network.PlayerDataV06) {
            this.spawnIndex = ((com.corona.game.Network.PlayerDataV06) playerData).spawnIndex;
        }
        this.spawnLoc = playerData.spawnLoc;
        this.dirFacing = playerData.dirFacing;
        this.position = playerData.position;
        this.name = playerData.name;
        this.pokemon = new ArrayList<>();
        Iterator<com.corona.game.Network.PokemonData> it = playerData.pokemon.iterator();
        while (it.hasNext()) {
            com.corona.game.Network.PokemonDataBase pokemonData = it.next();
            if (pokemonData instanceof com.corona.game.Network.PokemonDataV07) {
                ((com.corona.game.Network.PokemonDataV07) pokemonData).interiorIndex = 100;
            }
            this.pokemon.add(new Pokemon(pokemonData));
        }
        if (this.pokemon.size() > 0) {
            this.currPokemon = this.pokemon.get(0);
        }
        setPlayerItems(playerData.itemsDict);
        this.network = new Network(this.position.cpy());
        this.network.id = playerData.id;
        this.network.number = playerData.number;
        this.displayedMaxPartyText = playerData.displayedMaxPartyText;
        if (playerData.isInterior) {
            this.network.tiles = Game.staticGame.map.interiorTiles.get(Game.staticGame.map.interiorTilesIndex);
            this.buildTiles = this.indoorBuildTiles;
        } else {
            this.network.tiles = Game.staticGame.map.overworldTiles;
        }
        if (playerData instanceof com.corona.game.Network.PlayerDataV07) {
            this.character = ((com.corona.game.Network.PlayerDataV07) playerData).character;
            this.enteredDesertBiome = ((com.corona.game.Network.PlayerDataV07) playerData).enteredDesertBiome;
        }
        if (Game.staticGame.dangerousDebugInputEnabled) {
            this.pokemon.clear();
            Pokemon pokemon = new Pokemon("aexeggutor", 99, Pokemon.Generation.CRYSTAL);
            pokemon.gender = "female";
            pokemon.attacks[1] = "leech life";
            pokemon.attacks[2] = "recover";
            pokemon.happiness = 0;
            this.pokemon.add(pokemon);
            this.pokemon.add(new Pokemon("rhydon", 99, Pokemon.Generation.CRYSTAL));
            this.pokemon.add(new Pokemon("smeargle", 100, Pokemon.Generation.CRYSTAL));
            this.pokemon.add(new Pokemon("sharpedo", 60, Pokemon.Generation.CRYSTAL));
            this.pokemon.add(new Pokemon("gallade", 3, Pokemon.Generation.CRYSTAL));
            this.pokemon.add(new Pokemon("pidgeot", 30, Pokemon.Generation.CRYSTAL));
            this.character = "brendan";
            this.name = "brendan";
            playerData.color = new Color(0.972549f, 0.21960784f, 0.03137255f, 1.0f);
            setItemAmount("rare candy", 99);
            setItemAmount("master ball", 99);
            setItemAmount("spell tag", 99);
            setItemAmount("nevermeltice", 99);
            setItemAmount("metal coat", 99);
            setItemAmount("magnet", 99);
            setItemAmount("berry seed", 99);
            setItemAmount("cursed soil", 99);
            setItemAmount("ashen soil", 99);
            setItemAmount("dry soil", 99);
            setItemAmount("dry sand", 99);
            setItemAmount("log", 99);
            setItemAmount("grass", 99);
            setItemAmount("lum berry", 99);
            setItemAmount("pecha berry", 99);
            setItemAmount("cheri berry", 99);
            setItemAmount("aspear berry", 99);
            setItemAmount("chesto berry", 99);
            setItemAmount("rawst berry", 99);
            setItemAmount("persim berry", 99);
            setItemAmount("love ball", 99);
            setItemAmount("fast ball", 99);
            setItemAmount("lure ball", 99);
            setItemAmount("moon ball", 99);
            setItemAmount("friend ball", 99);
            setItemAmount("heavy ball", 99);
            setItemAmount("stardust", 99);
            setItemAmount("psi energy", 99);
            setItemAmount("charcoal", 99);
            setItemAmount("hard shell", 99);
            setItemAmount("sweet apple", 99);
            setItemAmount("secret key", 99);
            setItemAmount("pink apricorn", 99);
            setItemAmount("life force", 99);
            setItemAmount("big pearl", 99);
            setItemAmount("dusk ball", 99);
            setItemAmount("damp soil", 99);
            setItemAmount("mystic soil", 99);
            setItemAmount("repel", 99);
        }
        if ((playerData instanceof com.corona.game.Network.PlayerData) && ((com.corona.game.Network.PlayerData) playerData).fieldMovePokemonIndex > -1) {
            this.currFieldMove = ((com.corona.game.Network.PlayerData) playerData).currFieldMove;
            this.hmPokemon = this.pokemon.get(((com.corona.game.Network.PlayerData) playerData).fieldMovePokemonIndex);
        }
        setColor(playerData.color);
    }

    public boolean hasCraftRequirements(ArrayList<Craft> crafts2, int craftIndex, int amount) {
        return hasCraftRequirements(crafts2.get(craftIndex), amount);
    }

    public boolean hasCraftRequirements(Craft craft, int amount) {
        boolean hasRequirements = true;
        Iterator<Craft> it = craft.requirements.iterator();
        while (it.hasNext()) {
            Craft req = it.next();
            hasRequirements = false;
            Iterator<String> it2 = getItemsDict().keySet().iterator();
            while (true) {
                if (!it2.hasNext()) {
                    break;
                }
                String item = it2.next();
                if (item.equals(req.name) && getItemAmount(item).intValue() >= req.amount * amount) {
                    hasRequirements = true;
                    break;
                }
            }
            if (!hasRequirements) {
                break;
            }
        }
        return hasRequirements;
    }

    public boolean checkNearCampfire() {
        this.nearAggroPokemon = false;
        this.nearCacturne = false;
        boolean foundCampfire = this.hmPokemon != null && this.hmPokemon.hms.contains("FLASH");
        Vector2 startPos = this.position.cpy().add(-64.0f, -64.0f);
        startPos.x = (float) (((int) startPos.x) - (((int) startPos.x) % 16));
        startPos.y = (float) (((int) startPos.y) - (((int) startPos.y) % 16));
        Vector2 endPos = this.position.cpy().add(64.0f, 64.0f);
        endPos.x = (float) (((int) endPos.x) - (((int) endPos.x) % 16));
        endPos.y = (float) (((int) endPos.y) - (((int) endPos.y) % 16));
        Vector2 currPos = new Vector2(startPos.x, startPos.y);
        while (currPos.y < endPos.y) {
            Tile tile = Game.staticGame.map.tiles.get(currPos);
            currPos.x += 16.0f;
            if (currPos.x > endPos.x) {
                currPos.x = startPos.x;
                currPos.y += 16.0f;
            }
            if (tile != null) {
                if (tile.nameUpper.contains("campfire")) {
                    foundCampfire = true;
                } else if (tile.items != null && tile.items.containsKey("torch")) {
                    foundCampfire = true;
                } else if (tile.nameUpper.equals("cactus2_cacturne")) {
                    this.nearCacturne = true;
                } else if (Game.staticGame.map.pokemon.containsKey(tile.position)) {
                    Pokemon pokemon = Game.staticGame.map.pokemon.get(tile.position);
                    if (pokemon.aggroPlayer) {
                        this.nearAggroPokemon = true;
                    }
                    if (pokemon.hms.contains("FLASH")) {
                        foundCampfire = true;
                    }
                }
            }
        }
        if (Game.staticGame.map.tiles == Game.staticGame.map.overworldTiles) {
            updateMiniMap(Game.staticGame);
        }
        if (FogEffect.type != null && !FogEffect.effectArea.contains(this.position)) {
            FogEffect.refresh = true;
        }
        return foundCampfire;
    }

    public void updateBuildTiles(Game game) {
        Tile nextTile = game.map.tiles.get(facingPos());
        if (this.currFieldMove.equals("BUILD")) {
            if (game.map.tiles != game.map.overworldTiles || Game.staticGame.debugInputEnabled) {
                if (game.map.tiles != game.map.overworldTiles || !Game.staticGame.debugInputEnabled) {
                    if (this.hmPokemon == null || !this.hmPokemon.specie.name.equals("smeargle")) {
                        this.buildTiles = this.indoorBuildTiles;
                    } else {
                        this.buildTiles = this.smeargleInteriorTiles;
                    }
                } else if (this.hmPokemon != null && this.hmPokemon.specie.name.equals("smeargle")) {
                    this.buildTiles = this.smeargleBuildTiles;
                } else if (TileEditor.buildingTileUsed == 0) {
                    this.buildTiles = this.outdoorBuildTiles;
                } else if (TileEditor.buildingTileUsed == 1) {
                    this.buildTiles = this.woodedLakeBuildTiles;
                } else if (TileEditor.buildingTileUsed == 2) {
                    this.buildTiles = this.tundraBuildTiles;
                } else if (TileEditor.buildingTileUsed == 3) {
                    this.buildTiles = this.desertBuildTiles;
                } else {
                    this.buildTiles = this.bridgeBuildTiles;
                }
            } else if (this.hmPokemon != null && this.hmPokemon.specie.name.equals("smeargle")) {
                this.buildTiles = this.smeargleBuildTiles;
            } else if (nextTile.name.contains("desert")) {
                this.buildTiles = this.desertBuildTiles;
            } else if (nextTile.name.contains("bridge")) {
                this.buildTiles = this.bridgeBuildTiles;
            } else if (nextTile.biome.equals("tundra")) {
                this.buildTiles = this.tundraBuildTiles;
            } else if (nextTile.biome.equals("wooded_lake")) {
                this.buildTiles = this.woodedLakeBuildTiles;
            } else {
                this.buildTiles = this.outdoorBuildTiles;
            }
        } else if (this.currFieldMove.equals("DIG")) {
            this.buildTiles = this.terrainTiles;
            if (nextTile == null) {
                game.player.currBuildTile = game.player.currDigTile;
                return;
            } else if (!nextTile.nameUpper.contains("hole") && !nextTile.name.contains("water5") && !nextTile.name.contains("water2") && !nextTile.name.contains("lava")) {
                game.player.currBuildTile = game.player.currDigTile;
                return;
            }
        }
        while (this.buildTileIndex > 0 && this.buildTileIndex >= this.buildTiles.size()) {
            this.buildTileIndex--;
        }
        this.currBuildTile = this.buildTiles.get(this.buildTileIndex);
    }

    public void updateMiniMap(Game game) {
        if (this.dirFacing.equals("right")) {
            Vector2 startPos = this.position.cpy().add(112.0f, -128.0f);
            for (int i = 0; i < 16; i++) {
                startPos.y += 16.0f;
                Tile currTile = game.map.tiles.get(startPos);
                if (currTile != null) {
                    game.map.minimapQueue.add(currTile);
                }
            }
        } else if (this.dirFacing.equals("left")) {
            Vector2 startPos2 = this.position.cpy().add(-112.0f, -128.0f);
            for (int i2 = 0; i2 < 16; i2++) {
                startPos2.y += 16.0f;
                Tile currTile2 = game.map.tiles.get(startPos2);
                if (currTile2 != null) {
                    game.map.minimapQueue.add(currTile2);
                }
            }
        } else if (this.dirFacing.equals("up")) {
            Vector2 startPos3 = this.position.cpy().add(-128.0f, 112.0f);
            for (int i3 = 0; i3 < 16; i3++) {
                startPos3.x += 16.0f;
                Tile currTile3 = game.map.tiles.get(startPos3);
                if (currTile3 != null) {
                    game.map.minimapQueue.add(currTile3);
                }
            }
        } else if (this.dirFacing.equals("down")) {
            Vector2 startPos4 = this.position.cpy().add(-128.0f, -112.0f);
            for (int i4 = 0; i4 < 16; i4++) {
                startPos4.x += 16.0f;
                Tile currTile4 = game.map.tiles.get(startPos4);
                if (currTile4 != null) {
                    game.map.minimapQueue.add(currTile4);
                }
            }
        }
    }

    public void checkIfRouteChanged(Game game) {
        Tile targetTile = game.map.tiles.get(this.position);
        if (targetTile != null && targetTile.routeBelongsTo != null) {
            Route newRoute = targetTile.routeBelongsTo;
            if (!game.map.currRoute.type().equals(newRoute.type()) && !game.map.timeOfDay.equals("night")) {
                game.musicController.fadeToDungeon = true;
                if (newRoute.type().equals("desert") && !game.player.enteredDesertBiome) {
                    game.player.enteredDesertBiome = true;
                    game.player.canMove = false;
                    Player player = game.player;
                    Objects.requireNonNull(player);
                    game.insertAction(new Emote("!", new DisplayText(game, "The sun is scorching hot! This region feels dangerous...", (String) null, (Action) null, new RunCode(() -> {
                        game.player.canMove = true;
                    }, null))));
                }
                PkmnMap pkmnMap = game.map;
                Objects.requireNonNull(pkmnMap);
                game.insertAction(new PkmnMap.ShadeEffect(pkmnMap, newRoute.type()));
            }
            if (!game.map.currRoute.name.equals(newRoute.name)) {
                newRoute.music = game.map.currRoute.music;
                game.map.currRoute = newRoute;
            }
            game.map.currBiome = targetTile.biome;
        }
    }

    public void craftItem(ArrayList<Craft> crafts2, int craftIndex, int amount) {
        craftItem(crafts2.get(craftIndex), amount);
    }

    public void craftItem(Craft craft, int amount) {
        Iterator<Craft> it = craft.requirements.iterator();
        while (it.hasNext()) {
            Craft req = it.next();
            int newAmt = getItemAmount(req.name).intValue() - (req.amount * amount);
            setItemAmount(req.name, newAmt);
            if (newAmt <= 0) {
                getItemsDict().remove(req.name);
            }
        }
        int newAmt2 = amount;
        if (getItemsDict().containsKey(craft.name)) {
            newAmt2 = getItemAmount(craft.name).intValue() + newAmt2;
        }
        setItemAmount(craft.name, newAmt2);
    }

    public Vector2 facingPos() {
        return facingPos(this.dirFacing);
    }

    public Vector2 facingPos(String dirFacing) {
        Vector2 pos = null;
        if (dirFacing.equals("right")) {
            pos = this.position.cpy().add(16.0f, 0.0f);
        } else if (dirFacing.equals("left")) {
            pos = this.position.cpy().add(-16.0f, 0.0f);
        } else if (dirFacing.equals("up")) {
            pos = this.position.cpy().add(0.0f, 16.0f);
        } else if (dirFacing.equals("down")) {
            pos = this.position.cpy().add(0.0f, -16.0f);
        }
        return pos;
    }

    public void swapSpritesSurfing(Pokemon pokemon) {
        Map<String, Sprite> tempSprites = this.standingSprites;
        this.standingSprites = pokemon.standingSprites;
        if (pokemon.surfSprites != null) {
            this.standingSprites = pokemon.surfSprites;
        }
        pokemon.standingSprites = tempSprites;
        Map<String, Sprite> tempSprites2 = this.movingSprites;
        this.movingSprites = pokemon.movingSprites;
        if (pokemon.surfMovingSprites != null) {
            this.movingSprites = pokemon.surfMovingSprites;
        }
        pokemon.movingSprites = tempSprites2;
        Map<String, Sprite> tempSprites3 = this.altMovingSprites;
        this.altMovingSprites = pokemon.altMovingSprites;
        if (pokemon.surfMovingSprites != null) {
            this.altMovingSprites = pokemon.surfMovingSprites;
        }
        pokemon.altMovingSprites = tempSprites3;
        int temp = this.spriteOffsetY;
        this.spriteOffsetY = pokemon.spriteOffsetY;
        pokemon.spriteOffsetY = temp;
        this.hmPokemon = pokemon;
    }

    public void swapSprites(Pokemon pokemon) {
        Map<String, Sprite> tempSprites = this.standingSprites;
        this.standingSprites = pokemon.standingSprites;
        pokemon.standingSprites = tempSprites;
        Map<String, Sprite> tempSprites2 = this.movingSprites;
        this.movingSprites = pokemon.movingSprites;
        pokemon.movingSprites = tempSprites2;
        Map<String, Sprite> tempSprites3 = this.altMovingSprites;
        this.altMovingSprites = pokemon.altMovingSprites;
        pokemon.altMovingSprites = tempSprites3;
        int temp = this.spriteOffsetY;
        this.spriteOffsetY = pokemon.spriteOffsetY;
        pokemon.spriteOffsetY = temp;
        this.hmPokemon = pokemon;
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$CaughtFishAnim.class */
    public class CaughtFishAnim extends Action {
        public Action.Layer layer = Action.Layer.map_0;
        int timer = 0;

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public CaughtFishAnim(Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.timer % 4 == 0) {
                Player.this.position.y -= 1.0f;
            } else if (this.timer % 4 == 2) {
                Player.this.position.y += 1.0f;
            }
            if (this.timer >= 63) {
                game.actionStack.remove(this);
                game.insertAction(this.nextAction);
            }
            this.timer++;
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Emote.class */
    public class Emote extends Action {
        String type;
        Sprite sprite;
        public Action.Layer layer = Action.Layer.map_109;
        HashMap<String, Sprite> sprites = new HashMap<>();
        int timer = 0;

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public Emote(String type, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.type = type;
            Texture text = TextureCache.get(Gdx.files.internal("emotes.png"));
            int i = 0;
            for (String name : new String[]{"!", "?", "happy", "skull", "heart", "bolt", "sleep", "fish", "uncomfortable", "..."}) {
                this.sprites.put(name, new Sprite(text, 16 * i, 0, 16, 16));
                i++;
            }
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            this.sprite = this.sprites.get(this.type);
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            game.mapBatch.draw(this.sprite, Player.this.position.x, Player.this.position.y + 4.0f + 16.0f);
            if (this.timer >= 60) {
                game.actionStack.remove(this);
                game.insertAction(this.nextAction);
            }
            this.timer++;
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$FootPrintFade.class */
    public class FootPrintFade extends Action {
        String dirFacing;
        Vector2 position;
        public Action.Layer layer = Action.Layer.map_131;
        Color color = new Color();
        float alpha = 0.35f;
        int timer = 0;
        public Sprite sprite = new Sprite(TextureCache.get(Gdx.files.internal("footprints1.png")), 0, 0, 16, 16);

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public FootPrintFade(String dirFacing, Vector2 position, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.position = position;
            this.dirFacing = dirFacing;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public String getCamera() {
            return "map";
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            if (this.dirFacing.equals("left")) {
                this.sprite.setRegion(0, 0, 16, 16);
            } else if (this.dirFacing.equals("up")) {
                this.sprite.setRegion(16, 0, 16, 16);
            } else if (this.dirFacing.equals("right")) {
                this.sprite.setRegion(0, 0, 16, 16);
                this.sprite.flip(true, false);
            } else if (this.dirFacing.equals("down")) {
                this.sprite.setRegion(16, 0, 16, 16);
                this.sprite.flip(false, true);
            }
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            this.color.set(game.mapBatch.getColor());
            game.mapBatch.setColor(this.color.r, this.color.g, this.color.b, this.alpha);
            game.mapBatch.draw(this.sprite, this.position.x, this.position.y);
            game.mapBatch.setColor(this.color);
            this.timer++;
            if (this.timer > 60 && this.timer % 8 == 0) {
                this.alpha -= 0.1f;
            }
            if (this.alpha <= 0.0f) {
                game.actionStack.remove(this);
                game.insertAction(this.nextAction);
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Sitting.class */
    public class Sitting extends Action {
        Tile sittingOn;
        Action standingAction;
        Sprite sittingSprite;
        int stopTimer = 0;
        int offsetX;
        int offsetY;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public Sitting(Tile sittingOn) {
            super(new Object[0]);
            Player.this = this$0;
            this.offsetX = 0;
            this.offsetY = 0;
            this.sittingOn = sittingOn;
            this.sittingSprite = new Sprite(this$0.sittingSprites);
            if (this.sittingOn.nameUpper.equals("house_couch1")) {
                this.sittingSprite.setRegion(0, 0, 16, 16);
                this.offsetY = 3;
            } else if (this.sittingOn.nameUpper.equals("house_couch2") || this.sittingOn.nameUpper.equals("house_couch3")) {
                this.sittingSprite.setRegion(32, 0, 16, 16);
                this.sittingSprite.flip(true, false);
                this.offsetX = 3;
                this.offsetY = 5;
            } else if (this.sittingOn.nameUpper.equals("house_couch4") || this.sittingOn.nameUpper.equals("house_couch5")) {
                this.sittingSprite.setRegion(32, 0, 16, 16);
                this.offsetX = -3;
                this.offsetY = 5;
            }
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            Player.this.isSitting = true;
            this.standingAction = Player.this.standingAction;
            game.actionStack.remove(this.standingAction);
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            game.mapBatch.draw(this.sittingSprite, this.sittingOn.position.x + ((float) this.offsetX), this.sittingOn.position.y + ((float) this.offsetY));
            if (InputProcessor.bJustPressed) {
                this.stopTimer = 30;
            }
            if (this.stopTimer > 0) {
                this.stopTimer--;
                if (this.stopTimer <= 0) {
                    game.actionStack.remove(this);
                    game.insertAction(new SetField(Player.this, "isSitting", false, new SetField(game, "playerCanMove", true, this.standingAction)));
                }
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$PuddleSplash.class */
    public class PuddleSplash extends Action {
        Vector2 offset;
        public Action.Layer layer = Action.Layer.map_141;
        int timer = 0;
        Sprite sprite = new Sprite(TextureCache.get(Gdx.files.internal("puddle3.png")));

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public PuddleSplash(Vector2 offset, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.offset = offset;
            this.nextAction = nextAction;
            this.sprite.setRegion(0, 0, 16, 16);
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            this.sprite.setPosition(Player.this.position.x, Player.this.position.y);
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.timer == 12) {
                this.sprite.setRegion(16, 0, 16, 16);
            }
            if (this.timer == 24) {
                this.sprite.setRegion(32, 0, 16, 16);
            }
            game.mapBatch.draw(this.sprite, this.sprite.getX() + this.offset.x, this.sprite.getY() + this.offset.y);
            this.timer++;
            if (this.timer > 36) {
                game.actionStack.remove(this);
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$SurfWakeAnim.class */
    public class SurfWakeAnim extends Action {
        Sprite sprite;
        public Action.Layer layer = Action.Layer.map_129;
        int timer = 0;
        boolean flipX = false;
        boolean flipY = false;

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public SurfWakeAnim(Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            this.sprite = new Sprite(TextureCache.get(Gdx.files.internal("wake1.png")));
            this.sprite.setPosition(Player.this.position.x, Player.this.position.y - 4.0f);
            if (Player.this.dirFacing.equals("right")) {
                this.flipX = true;
            } else if (Player.this.dirFacing.equals("up")) {
                this.sprite = new Sprite(TextureCache.get(Gdx.files.internal("wake2.png")));
                this.flipY = true;
                this.sprite.setPosition(Player.this.position.x, Player.this.position.y);
            } else if (Player.this.dirFacing.equals("down")) {
                this.sprite = new Sprite(TextureCache.get(Gdx.files.internal("wake2.png")));
                this.sprite.setPosition(Player.this.position.x, Player.this.position.y);
            }
            this.sprite.setRegion(0, 0, 16, 16);
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.timer == 12) {
                this.sprite.setRegion(16, 0, 16, 16);
            }
            if (this.timer == 24) {
                this.sprite.setRegion(32, 0, 16, 16);
            }
            float U = this.sprite.getU();
            float U2 = this.sprite.getU2();
            if (this.flipX) {
                U = this.sprite.getU2();
                U2 = this.sprite.getU();
            }
            float V = this.sprite.getV();
            float V2 = this.sprite.getV2();
            if (this.flipY) {
                V = this.sprite.getV2();
                V2 = this.sprite.getV();
            }
            game.mapBatch.draw(this.sprite.getTexture(), this.sprite.getX(), this.sprite.getY(), (float) this.sprite.getRegionWidth(), (float) this.sprite.getRegionHeight(), U, V, U2, V2);
            this.timer++;
            if (this.timer > 36) {
                game.actionStack.remove(this);
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$WaterSplash.class */
    public class WaterSplash extends Action {
        public Action.Layer layer;
        Vector2 offset;
        boolean flip;
        Sprite sprite;
        int timer;

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        public WaterSplash(Player this$0, boolean flip, Action nextAction) {
            this(flip, new Vector2(0.0f, 0.0f), nextAction);
        }

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public WaterSplash(boolean flip, Vector2 offset, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.layer = Action.Layer.map_114;
            this.flip = false;
            this.timer = 0;
            this.offset = offset;
            this.nextAction = nextAction;
            this.sprite = new Sprite(TextureCache.get(Gdx.files.internal("splash_anim4.png")));
            this.sprite.setRegion(0, 0, 16, 16);
            this.flip = flip;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.timer == 4) {
                this.sprite.setRegion(16, 0, 16, 16);
            } else if (this.timer == 5) {
                this.sprite.setRegion(32, 0, 16, 16);
            }
            game.mapBatch.draw(this.sprite.getTexture(), Player.this.position.x + this.offset.x, Player.this.position.y + 3.0f + this.offset.y, 16.0f, 16.0f, this.sprite.getRegionX(), this.sprite.getRegionY(), this.sprite.getRegionWidth(), this.sprite.getRegionHeight(), this.flip, false);
            this.timer++;
            if (this.timer >= 10) {
                game.actionStack.remove(this);
                game.insertAction(this.nextAction);
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$TeleportUp.class */
    class TeleportUp extends Action {
        public Action.Layer layer = Action.Layer.map_0;
        int timer = 0;
        int phase = 0;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public TeleportUp(Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            game.insertAction(new PlayMusic("teleport_start1", 0.4f, (Action) null));
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.phase == 0) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "right";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 1) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "up";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 2) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "left";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 3) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "down";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 2) {
                    Player.this.position.y += 1.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y += 1.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y += 3.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 4) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "right";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y += 3.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y += 4.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y += 5.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y += 5.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 5) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "up";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y += 7.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y += 7.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y += 7.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y += 8.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 6) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "left";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y += 9.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y += 9.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y += 9.0f;
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 7) {
                if (this.timer == 2) {
                    Player.this.isSitting = true;
                } else if (this.timer == 5) {
                    game.actionStack.remove(this);
                    game.insertAction(this.nextAction);
                }
            }
            this.timer++;
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$TeleportDown.class */
    class TeleportDown extends Action {
        public Action.Layer layer = Action.Layer.map_0;
        int timer = 0;
        int phase = 0;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public TeleportDown(Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            game.insertAction(new PlayMusic("teleport_end1", 0.4f, (Action) null));
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.phase == 0) {
                if (this.timer == 0) {
                    Player.this.isSitting = false;
                    Player.this.dirFacing = "down";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y -= 9.0f;
                } else if (this.timer == 2) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 1) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "right";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y -= 9.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y -= 9.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y -= 8.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y -= 7.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 2) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "up";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y -= 7.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y -= 7.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y -= 5.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y -= 5.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 3) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "left";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y -= 4.0f;
                } else if (this.timer == 2) {
                    Player.this.position.y -= 3.0f;
                } else if (this.timer == 4) {
                    Player.this.position.y -= 3.0f;
                } else if (this.timer == 6) {
                    Player.this.position.y -= 1.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 4) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "down";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                    Player.this.position.y -= 1.0f;
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 5) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "right";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 6) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "up";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 7) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "left";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    this.phase++;
                    this.timer = 0;
                }
            }
            if (this.phase == 8) {
                if (this.timer == 0) {
                    Player.this.dirFacing = "down";
                    Player.this.currSprite = Player.this.standingSprites.get(game.player.dirFacing);
                } else if (this.timer == 8) {
                    game.actionStack.remove(this);
                    game.insertAction(this.nextAction);
                    Tile tile = game.map.tiles.get(game.player.position);
                    if (tile != null) {
                        Route newRoute = tile.routeBelongsTo;
                        if (newRoute != null) {
                            game.map.currRoute = newRoute;
                            if (game.map.timeOfDay.equals("day")) {
                                PkmnMap pkmnMap = game.map;
                                Objects.requireNonNull(pkmnMap);
                                game.insertAction(new PkmnMap.ShadeEffect(pkmnMap, newRoute.type()));
                            }
                        }
                        if (!game.map.currRoute.name.equals(newRoute.name)) {
                            newRoute.music = game.map.currRoute.music;
                            game.map.currRoute = newRoute;
                        }
                        game.map.currBiome = tile.biome;
                    }
                    Player.this.isNearCampfire = Player.this.checkNearCampfire();
                }
            }
            this.timer++;
        }
    }

    /* access modifiers changed from: package-private */
    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Sliding.class */
    public class Sliding extends Action {
        Vector2 initialPos;
        Vector2 targetPos;
        public Action.Layer layer = Action.Layer.map_114;
        int timer = 0;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public Sliding(Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.nextAction = nextAction;
            if (this$0.hmPokemon != null) {
                this$0.hmPokemon.moveDirs.add(this$0.dirFacing);
                this$0.hmPokemon.numMoves.add(Float.valueOf(1.0f));
            }
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            this.initialPos = new Vector2(Player.this.position);
            game.map.tiles.get(this.initialPos);
            this.targetPos = Player.this.facingPos();
            game.map.tiles.get(this.targetPos);
        }

        @Override // com.corona.game.Action
        public Action.Layer getLayer() {
            return this.layer;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            Tile currTile;
            if (game.playerCanMove) {
                if (Player.this.dirFacing.equals("up")) {
                    Player.this.position.y += 2.0f;
                    game.cam.position.y += 2.0f;
                } else if (Player.this.dirFacing.equals("down")) {
                    Player.this.position.y -= 2.0f;
                    game.cam.position.y -= 2.0f;
                } else if (Player.this.dirFacing.equals("left")) {
                    Player.this.position.x -= 2.0f;
                    game.cam.position.x -= 2.0f;
                } else if (Player.this.dirFacing.equals("right")) {
                    Player.this.position.x += 2.0f;
                    game.cam.position.x += 2.0f;
                }
                if (this.timer == 2) {
                    Tile currTile2 = game.map.tiles.get(this.targetPos);
                    if (currTile2 != null && currTile2.nameUpper.contains("gate")) {
                        currTile2.overSprite = null;
                        game.insertAction(new PlayMusic("gate1", (Action) null));
                    }
                } else if (this.timer == 4 && (currTile = game.map.tiles.get(this.initialPos)) != null && currTile.nameUpper.contains("gate")) {
                    currTile.init(currTile.name, currTile.nameUpper, currTile.position, true, currTile.routeBelongsTo);
                    game.insertAction(new PlayMusic("gate2", (Action) null));
                }
                if (this.timer > 6) {
                    Tile nextTile = game.map.tiles.get(this.targetPos);
                    if (nextTile != null && (nextTile.name.contains("puddle1") || nextTile.isTidal)) {
                        Vector2 offset = new Vector2(0.0f, 0.0f);
                        Player player = game.player;
                        Objects.requireNonNull(player);
                        PuddleSplash puddleSplash = new PuddleSplash(offset, null);
                        if (nextTile.isTidal) {
                            offset.set(0.0f, 4.0f);
                            puddleSplash.layer = Action.Layer.map_116;
                        }
                        game.insertAction(puddleSplash);
                        Player player2 = game.player;
                        Objects.requireNonNull(player2);
                        game.insertAction(new WaterSplash(false, offset, null));
                    }
                    if (!(nextTile == null || nextTile.routeBelongsTo == null)) {
                        Route newRoute = nextTile.routeBelongsTo;
                        String newBiome = nextTile.biome;
                        if (!game.map.currRoute.type().equals(newRoute.type()) && !game.map.timeOfDay.equals("night")) {
                            game.musicController.fadeToDungeon = true;
                            if (newRoute.type().equals("desert") && !game.player.enteredDesertBiome) {
                                game.player.enteredDesertBiome = true;
                                game.player.canMove = false;
                                Player player3 = game.player;
                                Objects.requireNonNull(player3);
                                game.insertAction(new Emote("!", new DisplayText(game, "The sun is scorching hot! This region feels dangerous...", (String) null, (Action) null, new RunCode(() -> {
                                    game.player.canMove = true;
                                }, null))));
                            }
                            if (newRoute.type().equals("graveyard")) {
                                PkmnMap pkmnMap = game.map;
                                Objects.requireNonNull(pkmnMap);
                                game.insertAction(new PkmnMap.ShadeEffect(pkmnMap, newRoute.type()));
                            } else {
                                PkmnMap pkmnMap2 = game.map;
                                Objects.requireNonNull(pkmnMap2);
                                game.insertAction(new PkmnMap.ShadeEffect(pkmnMap2, newRoute.type()));
                            }
                        }
                        if (game.map.currRoute != newRoute) {
                            if (game.map.currRoute.name.equals(newRoute.name)) {
                                newRoute.music = game.map.currRoute.music;
                            } else {
                                newRoute.music = game.map.currRoute.music;
                                System.out.println("New Route: " + newRoute.name);
                            }
                            game.map.currRoute = newRoute;
                        }
                        game.map.currBiome = newBiome;
                    }
                    Player.this.isNearCampfire = Player.this.checkNearCampfire();
                    game.actionStack.remove(this);
                    game.insertAction(this.nextAction);
                    this.nextAction.step(game);
                }
                this.timer++;
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Flying.class */
    public class Flying extends Action {
        public Pokemon pokemon;
        public Sprite spritePart;
        boolean takingOff;
        int animIndex = 0;
        public int xOffset = 0;
        public int yOffset = 32;
        int yOffsetCounter = 0;
        public boolean acceptInput = true;
        public Color batchColor = new Color();
        public boolean drawShadow = true;
        public int xOffset2 = 0;
        public int yOffset2 = 0;
        Sprite shadow = new Sprite(TextureCache.get(Gdx.files.internal("shadow1.png")), 0, 0, 16, 16);

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public Flying(Pokemon pokemon, boolean takingOff, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.takingOff = false;
            this.pokemon = pokemon;
            this.takingOff = takingOff;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void firstStep(Game game) {
            game.insertAction(this.nextAction);
            Player.this.flyingAction = this;
            if (this.takingOff) {
                game.insertAction(new TakingOff(true, null));
                this.yOffset = 0;
            }
            game.player.hmPokemon = this.pokemon;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            if (this.drawShadow) {
                game.mapBatch.draw(this.shadow, Player.this.position.x, Player.this.position.y);
            }
            if (this.pokemon.specie.name.equals("mewtwo")) {
                this.pokemon.currOwSprite = this.pokemon.standingSprites.get(Player.this.dirFacing);
            } else if (this.animIndex < 68) {
                this.pokemon.currOwSprite = this.pokemon.standingSprites.get(Player.this.dirFacing);
            } else if (this.animIndex < 72) {
                this.pokemon.currOwSprite = this.pokemon.movingSprites.get(Player.this.dirFacing);
            } else if (this.animIndex < 76) {
                this.pokemon.currOwSprite = this.pokemon.standingSprites.get(Player.this.dirFacing);
            } else if (this.animIndex < 80) {
                this.pokemon.currOwSprite = this.pokemon.movingSprites.get(Player.this.dirFacing);
            }
            this.xOffset2 = 0;
            this.yOffset2 = 0;
            if (game.player.dirFacing.equals("up")) {
                this.yOffset2++;
            }
            if (game.player.dirFacing.equals("down")) {
                this.yOffset2 += 2;
            } else if (game.player.dirFacing.equals("right")) {
                this.xOffset2 -= 2;
                if (game.player.hmPokemon != null && game.player.hmPokemon.specie.name.equals("mewtwo")) {
                    this.yOffset2 += 2;
                    this.xOffset2--;
                } else if (this.pokemon.specie.name.equals("dragonite")) {
                    this.xOffset2 -= 2;
                    this.yOffset2 += 2;
                }
            } else if (game.player.dirFacing.equals("left")) {
                this.xOffset2 += 2;
                if (game.player.hmPokemon != null && game.player.hmPokemon.specie.name.equals("mewtwo")) {
                    this.yOffset2 += 2;
                    this.xOffset2++;
                } else if (this.pokemon.specie.name.equals("dragonite")) {
                    this.xOffset2 += 2;
                    this.yOffset2 += 2;
                }
            }
            Player.this.currSprite = new Sprite(Player.this.standingSprites.get(Player.this.dirFacing));
            this.spritePart = new Sprite(game.player.currSprite);
            this.spritePart.setRegionY(0);
            this.spritePart.setRegionHeight(14);
            this.batchColor.set(game.mapBatch.getColor());
            if (this.pokemon.hms.contains("FLASH")) {
                game.mapBatch.setColor(1.0f, 1.0f, 1.0f, 1.0f);
            }
            game.mapBatch.draw(this.spritePart, game.player.position.x + ((float) this.xOffset2) + ((float) this.xOffset), game.player.position.y + 21.0f + ((float) this.yOffset2) + ((float) this.yOffset));
            this.pokemon.position.set(Player.this.position.x + ((float) this.xOffset), Player.this.position.y + ((float) ((16 + this.yOffset) / 2)));
            game.mapBatch.draw(this.pokemon.currOwSprite, Player.this.position.x + ((float) this.xOffset), Player.this.position.y + 16.0f + ((float) this.yOffset));
            if (this.pokemon.specie.name.equals("dragonite")) {
                if (Player.this.dirFacing.equals("up")) {
                    game.mapBatch.draw(this.spritePart, game.player.position.x + ((float) this.xOffset2) + ((float) this.xOffset), game.player.position.y + 21.0f + ((float) this.yOffset2) + ((float) this.yOffset));
                }
            } else if (!Player.this.dirFacing.equals("down") || this.pokemon.specie.name.equals("mantine")) {
                game.mapBatch.draw(this.spritePart, game.player.position.x + ((float) this.xOffset2) + ((float) this.xOffset), game.player.position.y + 21.0f + ((float) this.yOffset2) + ((float) this.yOffset));
            }
            game.mapBatch.setColor(this.batchColor);
            if (!this.takingOff) {
                this.animIndex = (this.animIndex + 1) % 80;
                this.yOffsetCounter++;
                if (this.yOffsetCounter % 4 == 0) {
                    if (this.yOffsetCounter % 32 > 15) {
                        this.yOffset++;
                    } else {
                        this.yOffset--;
                    }
                }
                if (this.yOffsetCounter % 32 >= 31) {
                    this.yOffset = 32;
                }
                if (this.yOffsetCounter >= 255) {
                    this.yOffsetCounter = 0;
                    this.xOffset = 0;
                }
                if (Player.this.canMove) {
                    if (InputProcessor.startJustPressed) {
                        game.insertAction(new DrawPlayerMenu.Intro(game, new DrawPlayerMenu(game, new WaitFrames(game, 1, new SetField(Player.this, "canMove", true, null)))));
                        Player.this.canMove = false;
                    } else if (this.acceptInput) {
                        boolean shouldMove = false;
                        if (InputProcessor.upPressed) {
                            game.player.dirFacing = "up";
                            shouldMove = true;
                        } else if (InputProcessor.downPressed) {
                            game.player.dirFacing = "down";
                            shouldMove = true;
                        } else if (InputProcessor.leftPressed) {
                            game.player.dirFacing = "left";
                            shouldMove = true;
                        } else if (InputProcessor.rightPressed) {
                            game.player.dirFacing = "right";
                            shouldMove = true;
                        } else if (InputProcessor.bJustPressed) {
                            Tile tile = game.map.tiles.get(game.player.position);
                            if (tile.isWater) {
                                Pokemon surfMon = null;
                                Iterator<Pokemon> it = game.player.pokemon.iterator();
                                while (true) {
                                    if (!it.hasNext()) {
                                        break;
                                    }
                                    Pokemon pokemon = it.next();
                                    if (pokemon.hms.contains("SURF")) {
                                        surfMon = pokemon;
                                        break;
                                    }
                                }
                                Pokemon belowPokemon = game.map.pokemon.get(game.player.position);
                                boolean pokemonInTheWay = belowPokemon != null && belowPokemon.mapTiles == game.map.tiles;
                                if (surfMon != null && !pokemonInTheWay) {
                                    Player.this.hmPokemon = surfMon;
                                    this.takingOff = true;
                                    game.insertAction(new TakingOff(false, new PlayerStanding(game)));
                                    return;
                                }
                            }
                            if (!tile.isSolid && !tile.isLedge) {
                                this.takingOff = true;
                                game.insertAction(new TakingOff(false, new PlayerStanding(game)));
                                return;
                            }
                        }
                        if (shouldMove) {
                            this.acceptInput = false;
                            game.insertAction(new Moving());
                        }
                    }
                }
            }
        }

        /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Flying$Moving.class */
        public class Moving extends Action {
            int timer = 0;

            /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
            public Moving() {
                super(new Object[0]);
                Flying.this = this$1;
            }

            @Override // com.corona.game.Action
            public void step(Game game) {
                String awayDir;
                if (Player.this.dirFacing.equals("up")) {
                    Player.this.position.y += 2.0f;
                } else if (Player.this.dirFacing.equals("down")) {
                    Player.this.position.y -= 2.0f;
                } else if (Player.this.dirFacing.equals("right")) {
                    Player.this.position.x += 2.0f;
                } else if (Player.this.dirFacing.equals("left")) {
                    Player.this.position.x -= 2.0f;
                }
                game.cam.position.set(Player.this.position.x + 16.0f, Player.this.position.y + 16.0f, 0.0f);
                this.timer++;
                if (this.timer >= 8) {
                    game.actionStack.remove(this);
                    Player.this.checkIfRouteChanged(game);
                    if (FogEffect.type != null && !FogEffect.effectArea.contains(Player.this.position)) {
                        FogEffect.refresh = true;
                    }
                    Player.this.updateMiniMap(game);
                    if (!game.map.boundingBox().contains(Player.this.position)) {
                        if (Player.this.position.y > game.map.boundingBox().y + game.map.boundingBox().height) {
                            awayDir = "down";
                        } else if (Player.this.position.y < game.map.boundingBox().y) {
                            awayDir = "up";
                        } else if (Player.this.position.x < game.map.boundingBox().x) {
                            awayDir = "right";
                        } else {
                            awayDir = "left";
                        }
                        int something = 100;
                        int randNum = Game.rand.nextInt(4) + 2;
                        if (randNum > 4) {
                            something = 80;
                        } else if (randNum > 3) {
                            something = 90;
                        }
                        game.insertAction(new DisplayText(game, "Going further will take you to a new area... keep going?", (String) null, true, false, (Action) new DrawYesNoMenu(null, new DisplayText.Clear(game, new WaitFrames(game, 3, new FadeMusic(game.currMusic, -0.0125f, game.currMusic.getVolume(), true, new GenerateWorld(100 * something * (randNum + 2), Player.this.dirFacing, new Moving())))), new DisplayText.Clear(game, new WaitFrames(game, 3, new SetField(Player.this, "dirFacing", awayDir, new Moving()))))));
                        return;
                    }
                    Flying.this.acceptInput = true;
                }
            }
        }

        /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Flying$TakingOff.class */
        public class TakingOff extends Action {
            int timer = 0;
            boolean takingOff;

            /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
            public TakingOff(boolean takingOff, Action nextAction) {
                super(new Object[0]);
                Flying.this = this$1;
                this.takingOff = true;
                this.takingOff = takingOff;
                this.nextAction = nextAction;
            }

            @Override // com.corona.game.Action
            public void firstStep(Game game) {
                if (this.takingOff) {
                    if (Flying.this.pokemon.specie.name.equals("mewtwo")) {
                        game.insertAction(new PlayMusic("teleport_start1", 0.4f, (Action) null));
                    } else {
                        game.insertAction(new PlayMusic("fly_takingoff1", (Action) null));
                    }
                    Tile currTile = game.map.tiles.get(Player.this.position);
                    if (currTile != null && currTile.nameUpper.contains("gate")) {
                        currTile.init(currTile.name, currTile.nameUpper, currTile.position, true, currTile.routeBelongsTo);
                        game.insertAction(new PlayMusic("gate2", (Action) null));
                    }
                } else if (Flying.this.pokemon.specie.name.equals("mewtwo")) {
                    game.insertAction(new PlayMusic("teleport_end1", 0.4f, (Action) null));
                } else {
                    game.insertAction(new PlayMusic("fly_landing1", (Action) null));
                }
            }

            @Override // com.corona.game.Action
            public void step(Game game) {
                int extra = 0;
                if (this.takingOff && this.timer >= 64) {
                    extra = 8;
                } else if (this.timer % 4 == 0) {
                    if (this.takingOff) {
                        Flying.this.yOffset += 2;
                    } else {
                        Flying.this.yOffset -= 2;
                    }
                }
                Flying.this.animIndex = (((Flying.this.animIndex - 80) + 1) % (8 + extra)) + 80;
                if (Flying.this.pokemon.specie.name.equals("mewtwo")) {
                    Flying.this.pokemon.currOwSprite = Flying.this.pokemon.standingSprites.get(Player.this.dirFacing);
                } else if (Flying.this.animIndex < 84 + (extra / 2)) {
                    Flying.this.pokemon.currOwSprite = Flying.this.pokemon.standingSprites.get(Player.this.dirFacing);
                } else {
                    Flying.this.pokemon.currOwSprite = Flying.this.pokemon.movingSprites.get(Player.this.dirFacing);
                }
                this.timer++;
                if (!this.takingOff && this.timer < 80 && this.timer >= 64) {
                    game.cam.translate(0.0f, -1.0f);
                }
                if (this.takingOff && this.timer < 17 && this.timer >= 0) {
                    game.cam.translate(0.0f, 1.0f);
                }
                if (!this.takingOff && this.timer >= 80) {
                    game.actionStack.remove(this);
                    game.insertAction(this.nextAction);
                    game.player.flyingAction = null;
                    game.actionStack.remove(Flying.this);
                    Tile currTile = game.map.tiles.get(Player.this.position);
                    if (currTile != null && currTile.nameUpper.contains("gate")) {
                        currTile.overSprite = null;
                        game.insertAction(new PlayMusic("gate1", (Action) null));
                    }
                    if (currTile == null || !currTile.isWater) {
                        Player.this.currFieldMove = "";
                        Player.this.hmPokemon = null;
                        return;
                    }
                    Player.this.currFieldMove = "SURF";
                    Player.this.swapSpritesSurfing(Player.this.hmPokemon);
                } else if (this.takingOff && this.timer >= 96) {
                    Flying.this.takingOff = false;
                    game.actionStack.remove(this);
                    game.insertAction(this.nextAction);
                }
            }
        }
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$RemoveFromInventory.class */
    public class RemoveFromInventory extends Action {
        String itemName;
        int amount;

        /* JADX INFO: 'super' call moved to the top of the method (can break code semantics) */
        public RemoveFromInventory(String itemName, int amount, Action nextAction) {
            super(new Object[0]);
            Player.this = this$0;
            this.itemName = itemName;
            this.amount = amount;
            this.nextAction = nextAction;
        }

        @Override // com.corona.game.Action
        public void step(Game game) {
            Player.this.setItemAmount(this.itemName, Player.this.getItemAmount(this.itemName).intValue() - this.amount);
            if (game.player.getItemAmount(this.itemName).intValue() <= 0) {
                game.player.removeItem(this.itemName);
            }
            game.actionStack.remove(this);
            game.insertAction(this.nextAction);
        }
    }

    public Texture preventHairFlip(Texture text, int regionX, int offset) {
        TextureData temp = text.getTextureData();
        if (!temp.isPrepared()) {
            temp.prepare();
        }
        Pixmap currPixmap = temp.consumePixmap();
        Pixmap newPixmap = new Pixmap(16, 16, Pixmap.Format.RGBA8888);
        for (int i = 0; i < 16; i++) {
            for (int j = 0; j < 16; j++) {
                if (j < offset) {
                    newPixmap.drawPixel(i, j, currPixmap.getPixel(i + regionX, j));
                } else {
                    newPixmap.drawPixel(i, j, currPixmap.getPixel((15 - i) + regionX, j));
                }
            }
        }
        return TextureCache.get(newPixmap);
    }

    public void setColor(Color newColor) {
        setColor(newColor, false);
    }

    public void setColor(Color newColor, boolean skinColor) {
        Color replaceColor;
        Color replaceColor2;
        if (skinColor) {
            this.skinColor = newColor;
        } else {
            this.color = newColor;
        }
        boolean doingMod = true;
        FileHandle file = Gdx.files.local("mods/player/" + this.character + "/walking.png");
        if (!file.exists()) {
            doingMod = false;
            file = Gdx.files.internal("player/" + this.character + "-walking.png");
            if (!file.exists()) {
                this.character = "kris";
                file = Gdx.files.internal("player/" + this.character + "-walking.png");
            }
        }
        if (doingMod) {
            replaceColor = new Color(0.972549f, 0.21960784f, 0.03137255f, 1.0f);
        } else if (this.character.equals("gold") || this.character.equals("mark") || this.character.equals("red") || this.character.equals("chase") || this.character.equals("gloria") || this.character.equals("hilbert") || this.character.equals("lyra") || this.character.equals("serena") || this.character.equals("brendan") || this.character.equals("summer")) {
            replaceColor = new Color(0.972549f, 0.21960784f, 0.03137255f, 1.0f);
        } else if (this.character.equals("lunick")) {
            replaceColor = new Color(0.34901962f, 0.28235295f, 1.0f, 1.0f);
        } else if (this.character.equals("kellyn")) {
            replaceColor = new Color(0.9647059f, 0.03137255f, 0.003921569f, 1.0f);
        } else {
            replaceColor = new Color(0.3137255f, 0.28235295f, 0.972549f, 1.0f);
        }
        Texture playerText = TextureCache.get(file);
        if (!playerText.getTextureData().isPrepared()) {
            playerText.getTextureData().prepare();
        }
        Pixmap pixmap = playerText.getTextureData().consumePixmap();
        Color clearColor = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap = new Pixmap(playerText.getWidth(), playerText.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap.setColor(clearColor);
        coloredPixmap.fill();
        Color replaceWith = this.color;
        if (skinColor) {
            replaceColor = new Color(1.0f, 0.80784315f, 0.28235295f, 1.0f);
            replaceWith = this.skinColor;
        }
        for (int i = 0; i < playerText.getWidth(); i++) {
            for (int j = 0; j < playerText.getHeight(); j++) {
                Color color = new Color(pixmap.getPixel(i, j));
                if (color.equals(replaceColor)) {
                    color = replaceWith;
                }
                coloredPixmap.drawPixel(i, j, Color.rgba8888(color));
            }
        }
        Texture playerText2 = new Texture(coloredPixmap);
        this.standingSprites.put("down", new Sprite(playerText2, 0, 0, 16, 16));
        this.standingSprites.put("up", new Sprite(playerText2, 16, 0, 16, 16));
        this.standingSprites.put("left", new Sprite(playerText2, 32, 0, 16, 16));
        this.standingSprites.put("right", new Sprite(playerText2, 48, 0, 16, 16));
        this.movingSprites.put("down", new Sprite(playerText2, 64, 0, 16, 16));
        this.movingSprites.put("up", new Sprite(playerText2, 80, 0, 16, 16));
        this.movingSprites.put("left", new Sprite(playerText2, 96, 0, 16, 16));
        this.movingSprites.put("right", new Sprite(playerText2, 112, 0, 16, 16));
        if (this.character.equals("hilda")) {
            this.altMovingSprites.put("down", new Sprite(playerText2, 64, 0, 16, 16));
            this.altMovingSprites.get("down").flip(true, false);
            this.altMovingSprites.put("up", new Sprite(playerText2, 80, 0, 16, 16));
            this.altMovingSprites.get("up").flip(true, false);
        } else {
            int offset = 9;
            if (this.character.equals("elaine")) {
                offset = 11;
            } else if (this.character.equals("gloria")) {
                offset = 10;
            }
            this.altMovingSprites.put("down", new Sprite(preventHairFlip(playerText2, 64, offset), 0, 0, 16, 16));
            this.altMovingSprites.put("up", new Sprite(preventHairFlip(playerText2, 80, offset), 0, 0, 16, 16));
        }
        this.altMovingSprites.put("left", new Sprite(playerText2, 96, 0, 16, 16));
        this.altMovingSprites.put("right", new Sprite(playerText2, 112, 0, 16, 16));
        FileHandle file2 = Gdx.files.local("mods/player/" + this.character + "/running.png");
        if (!file2.exists()) {
            file2 = Gdx.files.internal("player/" + this.character + "-running.png");
        }
        Texture playerText3 = TextureCache.get(file2);
        if (!playerText3.getTextureData().isPrepared()) {
            playerText3.getTextureData().prepare();
        }
        Pixmap pixmap2 = playerText3.getTextureData().consumePixmap();
        Color clearColor2 = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap2 = new Pixmap(playerText3.getWidth(), playerText3.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap2.setColor(clearColor2);
        coloredPixmap2.fill();
        for (int i2 = 0; i2 < playerText3.getWidth(); i2++) {
            for (int j2 = 0; j2 < playerText3.getHeight(); j2++) {
                Color color2 = new Color(pixmap2.getPixel(i2, j2));
                if (color2.equals(replaceColor)) {
                    color2 = replaceWith;
                }
                coloredPixmap2.drawPixel(i2, j2, Color.rgba8888(color2));
            }
        }
        Texture playerText4 = new Texture(coloredPixmap2);
        this.standingSprites.put("down_running", new Sprite(playerText4, 0, 0, 16, 16));
        this.standingSprites.put("up_running", new Sprite(playerText4, 16, 0, 16, 16));
        this.standingSprites.put("left_running", new Sprite(playerText4, 32, 0, 16, 16));
        this.standingSprites.put("right_running", new Sprite(playerText4, 48, 0, 16, 16));
        this.movingSprites.put("down_running", new Sprite(playerText4, 64, 0, 16, 16));
        this.movingSprites.put("up_running", new Sprite(playerText4, 80, 0, 16, 16));
        this.movingSprites.put("left_running", new Sprite(playerText4, 96, 0, 16, 16));
        this.movingSprites.put("right_running", new Sprite(playerText4, 112, 0, 16, 16));
        if (this.character.equals("hilda")) {
            this.altMovingSprites.put("down_running", new Sprite(playerText4, 64, 0, 16, 16));
            this.altMovingSprites.get("down_running").flip(true, false);
            this.altMovingSprites.put("up_running", new Sprite(playerText4, 80, 0, 16, 16));
            this.altMovingSprites.get("up_running").flip(true, false);
        } else {
            int offset2 = 10;
            if (this.character.equals("elaine")) {
                offset2 = 12;
            } else if (this.character.equals("gloria")) {
                offset2 = 11;
            }
            this.altMovingSprites.put("down_running", new Sprite(preventHairFlip(playerText4, 64, offset2), 0, 0, 16, 16));
            this.altMovingSprites.put("up_running", new Sprite(preventHairFlip(playerText4, 80, offset2), 0, 0, 16, 16));
        }
        this.altMovingSprites.put("left_running", new Sprite(playerText4, 96, 0, 16, 16));
        this.altMovingSprites.put("right_running", new Sprite(playerText4, 112, 0, 16, 16));
        FileHandle file3 = Gdx.files.local("mods/player/" + this.character + "/sleepingbag.png");
        if (!file3.exists()) {
            file3 = Gdx.files.internal("player/" + this.character + "-sleepingbag.png");
        }
        Texture playerText5 = TextureCache.get(file3);
        if (!playerText5.getTextureData().isPrepared()) {
            playerText5.getTextureData().prepare();
        }
        Pixmap pixmap3 = playerText5.getTextureData().consumePixmap();
        Color clearColor3 = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap3 = new Pixmap(playerText5.getWidth(), playerText5.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap3.setColor(clearColor3);
        coloredPixmap3.fill();
        for (int i3 = 0; i3 < playerText5.getWidth(); i3++) {
            for (int j3 = 0; j3 < playerText5.getHeight(); j3++) {
                Color color3 = new Color(pixmap3.getPixel(i3, j3));
                if (color3.equals(replaceColor)) {
                    color3 = replaceWith;
                }
                coloredPixmap3.drawPixel(i3, j3, Color.rgba8888(color3));
            }
        }
        this.sleepingSprite = new Sprite(new Texture(coloredPixmap3), 0, 0, 24, 16);
        FileHandle file4 = Gdx.files.local("mods/player/" + this.character + "/fishing.png");
        if (!file4.exists()) {
            file4 = Gdx.files.internal("player/" + this.character + "-fishing.png");
        }
        Texture playerText6 = TextureCache.get(file4);
        if (!playerText6.getTextureData().isPrepared()) {
            playerText6.getTextureData().prepare();
        }
        Pixmap pixmap4 = playerText6.getTextureData().consumePixmap();
        Color clearColor4 = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap4 = new Pixmap(playerText6.getWidth(), playerText6.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap4.setColor(clearColor4);
        coloredPixmap4.fill();
        for (int i4 = 0; i4 < playerText6.getWidth(); i4++) {
            for (int j4 = 0; j4 < playerText6.getHeight(); j4++) {
                Color color4 = new Color(pixmap4.getPixel(i4, j4));
                if (color4.equals(replaceColor)) {
                    color4 = replaceWith;
                }
                coloredPixmap4.drawPixel(i4, j4, Color.rgba8888(color4));
            }
        }
        this.fishingSprites = new Sprite(new Texture(coloredPixmap4), 0, 0, 56, 24);
        FileHandle file5 = Gdx.files.local("mods/player/" + this.character + "/sitting.png");
        if (!file5.exists()) {
            file5 = Gdx.files.internal("player/" + this.character + "-sitting.png");
        }
        Texture playerText7 = TextureCache.get(file5);
        if (!playerText7.getTextureData().isPrepared()) {
            playerText7.getTextureData().prepare();
        }
        Pixmap pixmap5 = playerText7.getTextureData().consumePixmap();
        Color clearColor5 = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap5 = new Pixmap(playerText7.getWidth(), playerText7.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap5.setColor(clearColor5);
        coloredPixmap5.fill();
        for (int i5 = 0; i5 < playerText7.getWidth(); i5++) {
            for (int j5 = 0; j5 < playerText7.getHeight(); j5++) {
                Color color5 = new Color(pixmap5.getPixel(i5, j5));
                if (color5.equals(replaceColor)) {
                    color5 = replaceWith;
                }
                coloredPixmap5.drawPixel(i5, j5, Color.rgba8888(color5));
            }
        }
        this.sittingSprites = new Sprite(new Texture(coloredPixmap5), 0, 0, 48, 16);
        boolean doingMod2 = true;
        FileHandle file6 = Gdx.files.local("mods/player/" + this.character + "/back.png");
        if (!file6.exists()) {
            doingMod2 = false;
            file6 = Gdx.files.internal("player/" + this.character + "-back.png");
        }
        Texture playerText8 = TextureCache.get(file6);
        if (doingMod2) {
            replaceColor2 = new Color(0.6901961f, 0.28235295f, 0.15686275f, 1.0f);
        } else if (this.character.equals("kris") || this.character.equals("elaine") || this.character.equals("leaf")) {
            replaceColor2 = new Color(0.21960784f, 0.15686275f, 0.972549f, 1.0f);
        } else if (this.character.equals("calem")) {
            replaceColor2 = new Color(0.21176471f, 0.3254902f, 0.77254903f, 1.0f);
        } else if (this.character.equals("gloria")) {
            replaceColor2 = new Color(0.21568628f, 0.5254902f, 0.43137255f, 1.0f);
        } else if (this.character.equals("hilbert")) {
            replaceColor2 = new Color(0.34509805f, 0.3764706f, 0.72156864f, 1.0f);
        } else if (this.character.equals("hilda")) {
            replaceColor2 = new Color(0.60784316f, 0.22745098f, 0.1882353f, 1.0f);
        } else if (this.character.equals("lunick")) {
            replaceColor2 = new Color(0.7764706f, 0.22352941f, 0.2901961f, 1.0f);
        } else if (this.character.equals("kellyn")) {
            replaceColor2 = new Color(0.9098039f, 0.30980393f, 0.30980393f, 1.0f);
        } else if (this.character.equals("mark")) {
            replaceColor2 = new Color(0.9098039f, 0.30980393f, 0.30980393f, 1.0f);
        } else if (this.character.equals("mint")) {
            replaceColor2 = new Color(0.16078432f, 0.41960785f, 0.8235294f, 1.0f);
        } else if (this.character.equals("rosa")) {
            replaceColor2 = new Color(0.3137255f, 0.28235295f, 0.2509804f, 1.0f);
        } else if (this.character.equals("serena")) {
            replaceColor2 = new Color(0.87058824f, 0.16470589f, 0.16470589f, 1.0f);
        } else if (this.character.equals("summer")) {
            replaceColor2 = new Color(0.9098039f, 0.30980393f, 0.30980393f, 1.0f);
        } else {
            replaceColor2 = new Color(0.6901961f, 0.28235295f, 0.15686275f, 1.0f);
        }
        if (!playerText8.getTextureData().isPrepared()) {
            playerText8.getTextureData().prepare();
        }
        Pixmap pixmap6 = playerText8.getTextureData().consumePixmap();
        Color clearColor6 = new Color(0.0f, 0.0f, 0.0f, 0.0f);
        Pixmap coloredPixmap6 = new Pixmap(playerText8.getWidth(), playerText8.getHeight(), Pixmap.Format.RGBA8888);
        coloredPixmap6.setColor(clearColor6);
        coloredPixmap6.fill();
        if (skinColor) {
            replaceColor2 = new Color(0.972549f, 0.972549f, 0.972549f, 1.0f);
        }
        for (int i6 = 0; i6 < playerText8.getWidth(); i6++) {
            for (int j6 = 0; j6 < playerText8.getHeight(); j6++) {
                Color color6 = new Color(pixmap6.getPixel(i6, j6));
                if (color6.equals(replaceColor2)) {
                    color6 = replaceWith;
                }
                coloredPixmap6.drawPixel(i6, j6, Color.rgba8888(color6));
            }
        }
        this.battleSprite = new SpriteProxy(new Texture(coloredPixmap6), 0, 0, 48, 48);
    }

    public void setCurrPokemon() {
        Iterator<Pokemon> it = this.pokemon.iterator();
        while (it.hasNext()) {
            it.next().participatedInBattle = false;
        }
        if (this.hmPokemon == null || this.hmPokemon.currentStats.get("hp").intValue() <= 0 || this.hmPokemon.isEgg) {
            Iterator<Pokemon> it2 = this.pokemon.iterator();
            while (it2.hasNext()) {
                Pokemon currPokemon = it2.next();
                if (currPokemon.currentStats.get("hp").intValue() > 0 && !currPokemon.isEgg) {
                    this.currPokemon = currPokemon;
                    return;
                }
            }
            return;
        }
        this.currPokemon = this.hmPokemon;
    }

    /* loaded from: pokewilds.jar:com/pkmngen/game/Player$Network.class */
    public class Network {
        public int connectionId;
        public String number;
        com.corona.game.Network.BattleData doEncounter;
        public Map<Vector2, Tile> tiles;
        public boolean isInterior;
        public LoadingZone loadingZone = new LoadingZone();
        public String id = null;
        public boolean shouldMove = false;
        public String dirFacing = "down";
        public boolean isRunning = false;
        public int syncTimer = 0;

        public Network(Vector2 position) {
            this.loadingZone.setSize(768.0f, 768.0f);
            this.loadingZone.setCenter(position);
            this.loadingZone.inner = new LoadingZone();
            this.loadingZone.inner.setSize(224.0f, 224.0f);
            this.loadingZone.inner.setCenter(position);
        }
    }
}
